<?xml version="1.0" encoding="utf-8"?>
<process version="1" name="Cancellation" xmlns="http://www.nginn.org/WorkflowDefinition.1_0.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<description>
		Test cases for cancellation.
			Case 1. Cancellation of atomic task / tasks
			Case 2. Cancellation of composite task
			Case 3. OnCancel out flow
			Case 4. Cancellation of a subprocess
			Case 5. Cancellation of multi-instance task
	</description>
    <dataTypes>
    </dataTypes>
    <variables>
		<variable name="v1" type="int" dir="In" required="true" />
    </variables>
    <body>
        <places>
            <place id="start" type="Start" />
            <place id="end" type="End" />
			<place id="p0" />
			<place id="p4" />
			<place id="p5" />
        </places>
        <tasks>
            <task id="T0" type="Empty" splitType="AND">
            </task>
			
			<task id="T1" type="ReceiveMessage">
				<parameters>
					<param variable="MessageCorrelationId"><expr>taskInstance.ProcessInstanceId + '.T1'</expr></param>
				</parameters>
            </task>
			
			<task id="T2" type="Timer">
				<variables>
				</variables>
				<outputBindings>
				</outputBindings>
				<parameters>
					<param variable="DelayAmount"><expr>TimeSpan.FromMinutes(1)</expr></param>
				</parameters>
            </task>
			
            <task id="T3_C" label="After cancel of T1" type="Empty" splitType="AND">
			</task>
			
			<composite id="T4" label="Composite">
				<body>
					<places>
                        <place id="T4_start" type="Start" />
                        <place id="T4_end" type="End" />
                    </places>
                    <tasks>
                        <task id="T4_T1" type="Timer">
                        	<parameters>
								<param variable="DelayAmount"><expr>TimeSpan.FromMinutes(1)</expr></param>
							</parameters>
						</task>
                    </tasks>
                    <flows>
                        <flow from="T4_start" to="T4_T1" />
                        <flow from="T4_T1" to="T4_end" />
                    </flows>
				</body>
			</composite>
			
			<task id="T5" type="Timer">
				<variables>
					<variable name="v1" type="int" dir="In" required="true" />
				</variables>
				<inputBindings>
					<bind variable="v1"><sourceVar>v1</sourceVar></bind>
				</inputBindings>
				<outputBindings>
				</outputBindings>
				<parameters>
					<param variable="DelayAmount"><expr>TimeSpan.FromSeconds(10 * Convert.ChangeType(data.v1, int))</expr></param>
				</parameters>
            </task>
			
			<task id="T6" label="Podproces" type="Subprocess">
				<variables>
					<variable name="userName" type="string" required="true" dir="In" />
				</variables>
				<inputBindings>
					<bind variable="userName">
						<expr>"podprocesowy_juzek"</expr>
					</bind>
				</inputBindings>
				<outputBindings>
				</outputBindings>
				<parameters>
					<param variable="SubprocessDefinition"><value>Test2.Sub.1</value></param>
				</parameters>
            </task>
        </tasks>
        <flows>
            <flow from="start" to="T0" />
            <flow from="T0" to="p0" />
			<flow from="p0" to="T1" />
			<flow from="T0" to="T2" />
			<flow from="T2" to="p0" cancelling="true"/>
            <flow from="T2" to="end" />
			<flow from="T1" to="end" />
			<flow from="T1" taskOutPort="Cancel" to="T3_C" />
			<flow from="T3_C" to="p4" />
			<flow from="p4" to="T4" />
			<flow from="T3_C" to="p5" />
			<flow from="p5" to="T5" />
			<flow from="p5" to="T6" />
			<flow from="T5" to="p4" cancelling="true" />
			<flow from="T4" to="p5" cancelling="true" />
			<flow from="T4" to="end" />
			<flow from="T5" to="end" />
			<flow from="T6" to="end" />
        </flows>
    </body>
</process>